<template>
  <section class="jumbotron">
    <h3 class="jumbotron-heading">github用户搜索</h3>
    <div>
      <input
        type="text"
        placeholder="输入用户名"
        v-model="keyword"
      />&nbsp;<button @click="search">搜索</button>
    </div>
  </section>
</template>

<script>
  import axios from 'axios'

  export default {
    name:'Search',
    data() {
      return {
        keyword:''
      }
    },
    methods: {
      search(){
        axios.get(`https://api.github.com/search/users?q=${this.keyword}`).then(
          response => {
            console.log(response.data)
          },
          error => {
            console.log(error.message)
          }
        )
      }
    },
  }
</script>

<style scoped>
  
</style>